home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / readahead-desktop < prev    next >
Text File  |  2008-10-27  |  2KB  |  84 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          readahead-desktop
  4. # Required-Start:    $local_fs readahead
  5. # Required-Stop:
  6. # X-Start-Before:    $network
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: init script for readahead (second stage)
  10. ### END INIT INFO
  11.  
  12. # Check the package is still installed
  13. [ -x /sbin/readahead-list ] || exit 0
  14.  
  15. # Get LSB functions
  16. . /lib/lsb/init-functions
  17. . /etc/default/rcS
  18.  
  19.  
  20. # Remember that any major changes to this script need to also be made to
  21. # readahead.init
  22.  
  23. # Remove the desktop list to disable this readhead phase
  24. [ -r /etc/readahead/desktop ] || exit 0
  25.  
  26. case "$1" in
  27.     start|restart|force-reload)
  28.     # This script is only run if /usr or /var are on a different
  29.     # filesystem.
  30.     if mountpoint -q /usr; then
  31.         dirs="$dirs /usr"
  32.     fi
  33.     if mountpoint -q /var; then
  34.         dirs="$dirs /var"
  35.     fi
  36.  
  37.     [ -n "$dirs" ] || exit 0
  38.  
  39.     # This can take a while
  40.     if type usplash_write >/dev/null 2>&1; then
  41.         usplash_write "TIMEOUT 360" || true
  42.     fi
  43.  
  44.     # If "profile" is placed on the kernel command-line we watch the boot
  45.     # sequence and generate new readahead lists, rather than read the lists
  46.     if ! grep -q "profile" /proc/cmdline; then
  47.         log_begin_msg "Reading files needed to boot (second stage)..."
  48.         if /sbin/start-stop-daemon --start --quiet \
  49.         --pidfile /var/run/readahead-list.bogus \
  50.         --startas /sbin/readahead-list -- -s /etc/readahead/desktop; then
  51.         log_end_msg 0
  52.         else
  53.         log_end_msg $?
  54.         fi
  55.     else
  56.         # Move the first stage's pid file so we can still kill it later
  57.         mv /var/run/readahead-watch.pid /var/run/readahead-watch-boot.pid
  58.  
  59.         # Just watch the newly mounted directories
  60.         log_begin_msg "Preparing to profile boot sequence (second stage)..."
  61.         if /sbin/start-stop-daemon --start --quiet \
  62.         --pidfile /var/run/readahead-watch.bogus \
  63.         --startas /sbin/readahead-watch \
  64.         -- -o /etc/readahead/desktop $dirs; then
  65.         log_end_msg 0    
  66.         else
  67.         log_end_msg $? || true
  68.         fi 
  69.     fi
  70.  
  71.     if type usplash_write >/dev/null 2>&1; then
  72.         usplash_write "TIMEOUT 15" || true
  73.     fi
  74.     ;;
  75.     stop)
  76.     ;;
  77.     *)
  78.     echo "Usage: /etc/init.d/readahead {start|stop|restart|force-reload}"
  79.     exit 1
  80.     ;;
  81. esac
  82.  
  83. exit 0
  84.